import {AxiosRequestConfig} from "axios"
import {ResType} from "st-common-req"
import request from "../request.ts"

/**
 * 发送 DELETE 请求
 *
 * @param {string} url 请求 url
 * @param {Record<string, any> | undefined} data 请求参数
 * @param {AxiosRequestConfig<any> | undefined} config 请求配置
 * @returns {Promise<ResType>} 请求结果
 */
export const del = async (
  url: string,
  data: Record<string, any> = {},
  config: AxiosRequestConfig<any> = {}
): Promise<ResType> => {
  return request.delete(url, {
    ...config,
    data,
  })
}
